package com.supermarket.order.api;

import com.supermarket.common.core.constant.ServiceNameConstants;
import com.supermarket.common.core.domain.R;
import com.supermarket.order.api.domain.OrderById;
import com.supermarket.order.api.factory.RemoteOrderFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
import java.util.Map;

@FeignClient(contextId = "remoteOrderService", value = ServiceNameConstants.ORDER_SERVICE, fallbackFactory = RemoteOrderFallbackFactory.class)
public interface RemoteOrderService {
    /**
     * 获取客户订单信息
     */
    @GetMapping("/order/getOrderListById/{id}")
    public R<List<OrderById>> getOrderListById(@PathVariable("id") Long id);

    @GetMapping("/order/getOrderMapByUserIds/{userIds}")
    public R<Map<Long, List<OrderById>>> getOrderMapByUserIds(@PathVariable("userIds") List<Long> userIds);
}
